<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMobileRechargeOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mobile_recharge_order', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->comment('用户id');
            $table->unsignedInteger('recharge_id')->comment('充值套餐id');
            $table->unsignedInteger('coupon_id')->default(0)->comment('优惠券id');
            $table->unsignedTinyInteger('type')->default(1)->comment('充值类型1套餐充值2直接充值');
            $table->unsignedDecimal('recharge_amount')->default(0.00)->comment('充值金额');
            $table->unsignedDecimal('pay_amount')->default(0)->comment('支付金额');
            $table->string('mobile',50)->comment('手机号');
            $table->unsignedDecimal('discount')->default(1)->comment('折扣');
            $table->unsignedInteger('months')->default(3)->comment('月数');
            $table->tinyInteger('status')->default(0)->comment('状态0未支付1已支付2待充值3充值完成-1已取消');
            $table->string('pay_id',50)->default('')->comment('支付序号');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mobile_recharge_order');
    }
}
